<?php
include("rss.php");
include("pumping.php");
include("dailypenfunctions.php");

// GLOBAL TIMEZONE SET
date_default_timezone_set('America/Montreal');

// CONSTANTS
$version = "1.0.2.10010";

// GLOBAL ERROR HANDLER
set_error_handler("ManageDailyPenErrors");

// HTML HEAD & META TAGS
echo GetDailyPenHTMLHead($version);

// HEADER
echo GetDailyPenHeader();

// UPDATE ARTICLES
UpdateArticles();

include("cache/articles.php");


//$sources = array('http://sports.yahoo.com/mlb/blog/big_league_stew/rss.xml',
//                    'http://www.cbssports.com/partners/feeds/rss/mlb_news',
//                    'http://espn.go.com/blog/feed?blog=sweetspot',
//                    'http://bleacherreport.com/articles/feed?tag_id=18',
//                    'http://www.nbcsports.com/rss/author/joe-posnanski/feed/');




//$feedobj = GetRSSObject($sources);
//for ($i=0; $i<4; $i++)
//{
//    $content = GetReadabilityContent($feedobj->get_item($i)->get_link());
//    echo "<h2>".$feedobj->get_item($i)->get_author()->get_name()."</h2>";
//    echo "<h2>".$feedobj->get_item($i)->get_date()."</h2>";
//    echo "<h2>".$feedobj->get_item($i)->get_title()."</h2>".preg_replace("/<img[^>]+\>/i", "", $content)."<hr>";
//}

//function WriteToCache($message,$num)
//{
//    $fp = fopen("cache/content".$num.".txt","wb");
//    fwrite($fp,$message);
//    fclose($fp);
//}

?>